import { nodeResolve } from '@rollup/plugin-node-resolve'
import terser from '@rollup/plugin-terser'

export default [
  // UMD 格式 - 适用于浏览器和Node.js
  {
    input: 'src/index.js',
    output: {
      file: 'dist/index.js',
      format: 'umd',
      name: 'ValidateUtils',
      sourcemap: true
    },
    plugins: [
      nodeResolve(),
      terser()
    ]
  },
  // ES Module 格式 - 适用于现代打包工具
  {
    input: 'src/index.js',
    output: {
      file: 'dist/index.esm.js',
      format: 'esm',
      sourcemap: true
    },
    plugins: [
      nodeResolve(),
      terser()
    ]
  },
  // CommonJS 格式 - 适用于Node.js
  {
    input: 'src/index.js',
    output: {
      file: 'dist/index.cjs.js',
      format: 'cjs',
      sourcemap: true
    },
    plugins: [
      nodeResolve(),
      terser()
    ]
  }
]
